package cn.fclub.print.invoice
{
	public class InvoiceConfig extends Object
	{
		private var _positions:XML = null;
		private var _type:String = '';
		private static const EXPRESS_NAME_SF:String = 'sf';
		private static const EXPRESS_NAME_EMS:String = 'ems';
		private static const EXPRESS_NAME_STO:String = 'sto';
		public function InvoiceConfig(str:String)
		{			
			super();
			type = str;
		}
		public function getPositions():XML
		{
			switch( type )
			{
				case EXPRESS_NAME_EMS:
					useEmsConfig();
					break;
				case EXPRESS_NAME_STO:
					useStoConfig();
					break;
				case EXPRESS_NAME_SF:
					default:
					useSfConfig();	
			}
			trace(positions);
			return positions;
		}
		
		// setting EMS express
		private function useEmsConfig():void
		{
			positions = 
				<express size="300">
					<orderSn x="86" y="17"/>
					<orderCell x="230" y="17"/>
					<sender x="30" y="48">默沙东揽投部</sender>
					<sender2 x="452" y="114">宝贝购</sender2>
						<siteName x="46" y="64">宝贝购</siteName>
					<companyAddress x="35" y="77" width="300" wrapLength="18" indent="18">浙江省 湖州市 吴兴区七幸路999号 金泰科技4栋</companyAddress>
					<companyPhone x="150" y="48">400-696-6161</companyPhone>
					<companyPostCode x="200" y="107">562400</companyPostCode>
						<rcvPerson x="34" y="138"/>
						<rcvMobile x="164" y="138"/>
					<rcvAddress x="23" y="161" append="bestTime" wrapLength="27" indent="18"/>
					<category x="50" y="265">服装</category>
					<goodsnum x="20" y="252"/>
					<right x="82" y="278">√</right>
					<payMethod x="352" y="238">√</payMethod>
					<isCod ifEqual="1">
								<right x="290" y="104">√</right>
								<codAmount x="368" y="108" />
								<codAmount2 x="300" y="121" />
					</isCod>
					<reMark x="444" y="238" wrapLength="7" noIndent="true">支持开包验货 请先验货后签收</reMark>
				</express>;
//			<!--
//			 * 一级元素支持：
//			 *  1. append 属性:text的内容=内容+其对应的值
//			 *  2. ifEqual 属性值为1时，其下的属性才显示
//			 *  3. wrapLength 属性是字符换行长度
//			-->

		}
		
		// setting STO express
		private function useStoConfig():void
		{
			positions = 
				<express size="300">
						<siteName x="38" y="57">宝贝购</siteName>
						<companyPhone x="60" y="158">400-696-6161</companyPhone>
					<companyAddress x="35" y="82" width="300" wrapLength="18" indent="18">浙江省 湖州市 吴兴区七幸路999号 金泰科技4栋</companyAddress>
					<orderSn x="187" y="0"/>
					<orderCell x="340" y="0"/>
					<reMark x="400" y="238" wrapLength="7" noIndent="true">支持开包验货 请先验货后签收</reMark>
					<rcvPerson x="313" y="56"/>
					<rcvAddress x="304" y="80" append="bestTime" wrapLength="17" indent="18"/>
					<rcvMobile x="330" y="157"/>
					<category x="40" y="177">服装</category>
					<goodsnum x="185" y="177"/>
					<sender x="72" y="237">宝贝购</sender>
					<right x="209" y="155">√</right>
				</express>;

			//			<!-- 
			//			 * 一级元素支持：
			//			 *  1. append 属性:text的内容=内容+其对应的值
			//			 *  2. ifEqual 属性值为1时，其下的属性才显示
			//			 *  3. wrapLength 属性是字符换行长度
			//			-->
		}
		
		// setting sf express
		private function useSfConfig():void
		{
			positions = <express size="370">
				<siteName x="145" y="95">聚尚网</siteName>
				<companyPhone x="190" y="155">4006-333-999</companyPhone>
				<companyAddress x="130" y="115" width="300" append="orderSn" wrapLength="32">上海市金桥路525号654幢上海市金桥路525号654上海市金桥路525号654</companyAddress>	
				<isCod ifEqual="1">
					<right x="337" y="120">√</right>
					<codAmount x="425" y="130" />
				</isCod>
				<rcvPerson x="145" y="210"/>
				<rcvAddress x="130" y="230" width="300" append="bestTime" wrapLength="32"/>
				<rcvMobile x="190" y="270"/>
				<category x="155" y="325">衣服</category>
			</express>;
			//			<!-- 
			//			 * 一级元素支持：
			//			 *  1. append 属性:text的内容=内容+其对应的值
			//			 *  2. ifEqual 属性值为1时，其下的属性才显示
			//			 *  3. wrapLength 属性是字符换行长度
			//			-->
		}

		public function get positions():XML
		{
			return _positions;
		}

		public function set positions(value:XML):void
		{
			_positions = value;
		}

		public function get type():String
		{
			return _type;
		}

		public function set type(value:String):void
		{
			_type = value;
		}
		
		
	}
}